#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <algorithm>

using namespace std;

bool compare(string &a, string &b)
{
    return a > b;
}

int main()
{
    int n;
    cin >> n;
    vector<string> v(n);
    for (int i = 0; i < n; i++)
    {
        cin >> v[i];
    }
    sort(v.begin(), v.end(), compare);
    stringstream ss;
    for(auto &s : v)
    {
        ss << s;
    }
    cout << ss.str() << endl;
    system("pause");
    return 0;
}